package com.smartcommunity.entity.people;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.alibaba.fastjson.JSON;
import com.smartcommunity.entity.tag.Tag;
import lombok.Getter;
import lombok.Setter;

/**
 * 入库es实有人口实体类
 *
 * @author yangyi
 * @since 2023年6月20日
 */
@Getter
@Setter
public class EsPeopleEntity {
	
	/**
	 * ID
	 */
    private Integer id;
    
    /**
     * 数据类型  1:实有人口  2:车辆 3:房屋  4:vid
     */
    private Integer dataType;
    
    /**
     * 户籍地址
     */
    private String domicileAddress;
    
    /**
     * 人员类型
     */
    private Integer peopleType;
    
    /**
     * 证件号码
     */
    private String credentialNo;

    /**
     * 旧的证件号码，更新使用
     */
    private String oldCredentialNo;
    
    /**
     * 证件类型
     */
    private String credentialType;
    
    /**
     * 姓名
     */
    private String peopleName;
    
    /**
     * 性别
     */
    private String gender;
    
    /**
     * 性别编码
     */
    private Integer genderCode;
    
    /**
     * 民族
     */
    private String nation;
    
    /**
     * 出生日期
     */
    private String birthDate;
    
    /**
     * 联系方式
     */
    private String phoneNo;
    
    /**
     * 证件照
     */
    private String idCardPic;
    
    /**
     * 文化程度
     */
    private String education;
    
    private String vid;
    
    private String featureId;
    
    private String faceId;
    
    /**
     * 标签
     */
    private String label;

    /**
     * 标签列表
     */
    private List<Tag> lableList = new ArrayList<Tag>();
    
    /**
     * 小区编码
     */
    private List<String> villageCode;
    
    /**
     * 人房关系
     */
    private List<RealPeopleHouse> detailAddress = new ArrayList<RealPeopleHouse>();
    
    /**
     * 入库时间
     */
    private Timestamp mrowTime;

    private Integer residentiaType;
	
	public String toString() {
        return JSON.toJSONString(this);
    }
	
	public static EsPeopleEntity parseFrom(People people) {
		EsPeopleEntity esPeople = new EsPeopleEntity();
        BeanUtils.copyProperties(people, esPeople);
        return esPeople;
	}
	
	public static People parseTo(EsPeopleEntity esPeople) {
		People people = new People();
		BeanUtils.copyProperties(esPeople, people);
		return people;
	}
	
}